<form class="form-inline" method="get">

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" type="number" name="parent_mobile" value="{$parent_mobile}"
                   placeholder="推荐人手机号">
        </div>
    </div>

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" type="number" name="mobile" value="{$mobile}"
                   placeholder="手机号">
        </div>
    </div>

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="nick_name" value="{$nick_name}"
                   placeholder="昵称">
        </div>
    </div>
    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <select class="form-control" name="user_type" id="user_type">
                <option value="">全部</option>
                <option value="1" {if $user_type eq 1}selected{/if}>游客</option>
                <option value="2" {if $user_type eq 2}selected{/if}>会员</option>
            </select>
        </div>
    </div>



    <div class="form-group col-xs-4">
        <div class="col-xs-12">
            <span style="">注册时间</span>{include file="public/dateRangePicker" picker-name="time_range" /}
        </div>
    </div>

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <button type="submit" class="btn btn-success">
                搜索
            </button>
        </div>
    </div>
</form>
<div class="form-group col-xs-2">
    <div class="col-xs-12">
        <button type="button" onclick="modal('{:url(\'add\')}', '添加会员')" class="btn btn-success">
            添加会员
        </button>
    </div>
</div>

<hr>

<table class="table table-striped">
    <thead>
    <tr>
        <td>ID</td>
        <td>手机【昵称】</td>
        <td>头像</td>
        <td>会员身份</td>
        <td>连续签到</td>
        <td>剩余积分</td>
        <td>总佣金</td>
        <td>已提现佣金</td>
        <td>黑名单</td>
        <td>注册时间</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>
            <p>
                <label class="label label-danger">{$item.mobile}</label>
            </p>
            <p>
                <label class="label label-info">{$item.nick_name}</label>
            </p>
        </td>
        <td>
            <a href="javascript:void(0);" onclick="ejectImg('{$item.avatar}','会员 {$item.nick_name} logo');">
                <img style="width: 4rem;" src="{$item.avatar|default_img}" />
            </a>
        </td>
        <td>
            {if $item.brand_id neq ""}
                {foreach :explode(",", $item.brand_id) as $bid}
                    <label class="label label-success">{$brand[$bid]}</label>
                {/foreach}

            {else}
            游客
            {/if}
        </td>
        <td>
            {$item.continuous_sign} 天
        </td>
        <td>
            {$item.score}
        </td>
        <td>
            {$item.commission_total}
        </td>
        <td>
            {$item.commission_ok}
        </td>
        <td>
            {if $item["in_blacklist"]}
            <label class="label label-danger">已拉黑</label>
            {else}
            <label class="label label-success">正常</label>
            {/if}
        </td>
        <td>{$item.create_time|show_datetime}</td>
        <td>
            <div class="btn-group">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    操作
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li>
                        <a href="javascript:void(0)" onclick="modal('{:url(\'edit\',array(\'id\'=>$item[\'id\']))}', '编辑会员')">
                            编辑
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0)" onclick="modal('{:url(\'invite\',array(\'id\'=>$item[\'id\'],\'type\'=>1))}', '会员{$item.mobile}的一级团队','80%','80%')">
                            一级团队
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0)" onclick="modal('{:url(\'invite\',array(\'id\'=>$item[\'id\'],\'type\'=>2))}', '会员{$item.mobile}的二级团队','80%','80%')">
                            二级团队
                        </a>
                    </li>
                    {if condition="$item.in_blacklist == 1"}
                    <li>
                        <a href="javascript:void(0)" data-toggle="confirm"
                           data-title="取消拉黑"
                           data-content="确认取消拉黑？请谨慎操作"
                           data-url="{:url('blacklist',array('id'=>$item['id'],'status'=>0))}">
                            取消拉黑
                        </a>
                    </li>
                    {else/}
                    <li>
                        <a href="javascript:void(0)" data-toggle="confirm"
                           data-title="加入黑名单"
                           data-content="确认拉黑？拉黑后会员前台将无法登录使用，请谨慎操作"
                           data-url="{:url('blacklist',array('id'=>$item['id'],'status'=>1))}">
                            拉黑
                        </a>
                    </li>
                    {/if}
                    <li role="separator" class="divider"></li>
                </ul>
            </div>
        </td>
    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>

<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {

        //获取分类
        $("#dutise-selector").select2({
            placeholder: "选择职务",
            allowClear: true
        });
        $("#industry-selector").select2({
            placeholder: "选择行业",
            allowClear: true
        });
        $("#user_type").select2({
            placeholder: "选择身份",
            allowClear: true
        });
    });
</script>
